package com.seal.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.seal.comm.utils.Page;
import com.seal.dao.IBusiInfoDao;
import com.seal.dto.BusiInfoDto;
import com.seal.model.BusiInfo;
import com.seal.service.IBusiInfoService;

@Service("busiInfoServiceImpl")
@Transactional(readOnly = true)
public class BusiInfoServiceImpl implements IBusiInfoService {

	@Resource(name = "busiInfoDaoImpl")
	private IBusiInfoDao busiInfoDao;

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false, rollbackForClassName = "Exception")
	public void addBusiInfo(BusiInfo businessInfo) throws Exception {
		busiInfoDao.addBusiInfo(businessInfo);
	}

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false, rollbackForClassName = "Exception")
	public void updateBusiInfo(BusiInfo businessInfo) throws Exception {
		busiInfoDao.updateBusiInfo(businessInfo);
	}

	public BusiInfo getBusiInfo(Long busiNo) throws Exception {
		return busiInfoDao.getBusiInfo(busiNo);
	}

	public List<BusiInfo> getAllBusiInfo(BusiInfoDto businessInfoDto, Page page)
			throws Exception {
		return busiInfoDao.getAllBusiInfo(businessInfoDto, page);
	}

	public List<BusiInfo> getAllCompanyBusiInfo(BusiInfoDto busiInfoDto,
			Page page) throws Exception {
		return busiInfoDao.getAllCompanyBusiInfo(busiInfoDto, page);
	}
	
	public int getCountByStatus(BusiInfoDto dto,String status){
		return busiInfoDao.getCountByStatus(dto,status);
	}
}
